'''
Created on 10.05.2011

@author: marion
'''
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt

colors = {
"ST": "green",
"SL": "red",
"OP": "black",
}
 
point_colors = {}

class Point(object):
    def __init__(self, id, x, y, z):
        self.id = id
        self.x = x
        self.y = y
        self.z = z
 
        @property
        def color(self):
            return colors[point_colors[self.id]]
        def __repr__(self):
            return "Point(%d, %f, %f, %f)" % (self.id, self.x, self.y, self.z)

def read_files():
    the_points = []
    for line in open("../../data/ExpPos-Part1.txt"):
        try:
            L = line.strip().split()
            if len(L) != 4:
                continue
            id, x, y, z = int(L[0]), float(L[1]), float(L[2]), float(L[3])
            point = Point(id, x, y, z)
            the_points.append(point)
        except:
            pass
    return the_points


# the random data
x = []
y = []
z = []

the_points = read_files()

for point in the_points:
    
    x.append(point.x/10000)
    y.append(point.y/10000)
    z.append(point.z/10000)


fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
n = 100
for c, m, zl, zh in [('r', 'o', -50, -25), ('b', '^', -30, -5)]:
    ax.scatter(x, y, z, c=c, marker=m)

ax.set_xlabel('X-direction')
ax.set_ylabel('Y-direction')
ax.set_zlabel('Z-direction')

plt.show()